﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="scheduler_agent_edit.aspx.cs" Inherits="Ccit.OA.Scheduler.scheduler_agent_edit" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>日程管理-代理设置</title>
     <script language="javascript" type="text/javascript" src="../script/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../script/StringClass_Ext.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jsonlib.js"></script>
    <script language="javascript" src="../script/jwindow.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jcontrol.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jbase64.js" type="text/javascript"></script>
    <script type="text/javascript">
         function OpenDept(vHid,vTxt)
            {
                var vuserid = document.getElementById("_hidUserId").value;
                OpenUserSingleSelect(vHid,vTxt,"",1,vuserid); 
            } 
         function CheckForm()
         {
            var userId = document.getElementById("_hidUserId").value;
            var ProxyId = document.getElementById("_hidProxyId").value;
            if(userId=="")
            {
                alert("被代理人名称不能为空!");
                return false;
            }
            if(ProxyId=="")
            {
                alert("代理人名称不能为空!");
                return false;
            }
            return true;
         }  
         function doSave(oType)
         {
            if(CheckForm()==false)return false;
            var MsSchProxy = {};
            var userId = document.getElementById("_hidUserId").value;
            var ProxyId = document.getElementById("_hidProxyId").value;
            var chkStyle = document.getElementById("chkStyle");
            if(chkStyle.checked==true)
            {
                MsSchProxy.ModifyFlag="1";
            }
            else
            {
                MsSchProxy.ModifyFlag="0";
            }
            MsSchProxy.UserId = userId;
            MsSchProxy.ProxyId = ProxyId;
             var jsonExpr = JSON.stringify(MsSchProxy,function(key,value){return value;});   
              MsSchProxy = null; 
              PageMethods.DoSaveSchProxy(jsonExpr,oType,ClientCallBack);  
         }
         function ClientCallBack(vResult)
         {
            if(vResult!="")
              {
                eval("SchProxyObj = "+vResult) 
                if(SchProxyObj.resultflag=="1")
                {
                    switch(SchProxyObj.resulttype){   
                            case "1":   
                                 alert(SchProxyObj.message); 
                                 doClear();                                        
                                 break;
                            case "2": 
                                   alert(SchProxyObj.message); 
                                   doBack();                                                    
                                  break;
                    }
                } 
                else if(SchProxyObj.resultflag=="-998")
                {
                     alert(SchProxyObj.message); 
                     return false;
                }
                else{
                     alert(SchProxyObj.message); 
                     return false;
                }
                SchProxyObj = null;
              }
         }
         function doBack()
         {
             var strUrl = "scheduler_agent_list.aspx";
             window.location.href=strUrl;
         }
         function doClear()
         {
            document.getElementById("_hidUserId").value="";
            document.getElementById("_hidProxyId").value="";
            document.getElementById("chkStyle"). checked=false ;
            document.getElementById("txtUserName").value ="";
            document.getElementById("txtProxyName").value ="";
         }
    </script>
</head>
<body>
    <ccit:ActionForm id="form1" runat="server">
     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <input  type="hidden" id="_hidUserId" runat="server" />
    <input  type="hidden" id="_hidProxyId" runat="server" />
    <table class="tbToolbar" cellpadding="0" cellspacing="0" width="98%" align="center">
                    <tr>
                        <td align="left">
                            <div class="tbSeparator"></div>
                        </td>
                        <td width="100%" class="titlebar">  
                            日程管理-代理设置
                        </td>                
                        <td align="right">
                            <nobr>  
                             </nobr>
                        </td> 
                    </tr>
       </table>
       <table cellpadding="0" class="tableborder" cellspacing="0" width="98%" align="center"  runat="server">
           <tr>
            <td align="right" width="10%" class="pformleft">被代理人</td>
            <td width="20%" class="pformright">
                <nobr>
                   <asp:TextBox ID="txtUserName"  CssClass="input" Width="80%"
                                                      runat="server" ReadOnly></asp:TextBox>
                                                        <a href="javascript:OpenDept('_hidUserId','txtUserName')" class="linktext"><IMG  id="IMG3" title="选择人员" src="../images/toolbar/view.gif" relaobj="txtUserName"></a>
                </nobr> 
            </td>  
          </tr>
          <tr>
             <td  align="right" width="8%" class="pformleft">代理人</td>
            <td width="15%" class="pformright">
                <nobr>
                  <asp:TextBox ID="txtProxyName"  CssClass="input" Width="80%"
                                                      runat="server" ReadOnly></asp:TextBox>
                                                        <a href="javascript:OpenDept('_hidProxyId','txtProxyName')" class="linktext"><IMG  id="IMG1" title="选择人员" src="../images/toolbar/view.gif" relaobj="txtProxyName"></a>
                </nobr> 
            </td>
          </tr>
          <tr>
             <td align="right" width="10%" class="pformleft">&nbsp;</td>
            <td width="15%" class="pformright">
            <nobr> 
                <asp:CheckBox ID="chkStyle" runat="server" Text="被代理人可修改日程"></asp:CheckBox>
            </nobr>
            </td> 
          </tr>
          <tr class="pformstrip" height="20">
           <td colspan="2" align="center">
                <input type="button" id="btnSave" value="保存并新增" class="button" onclick="doSave('1')" /> 
                &nbsp;
                 <input type="button" id="Button1" value="保存并返回" class="button" onclick="doSave('2')" /> 
                 &nbsp;
                  <input type="button" id="Button2" value="返回" class="button" onclick="doBack()" /> 
            </td>
        </tr>
        </table>
    </ccit:ActionForm>
</body>
</html>
